<?php $this->load->view('inc/header'); ?>
<!--content1-->
<div class="grid_12" style="background-color:#CCCCCC;">
<!--เมนูข้าง-->
<!--เมนูข้าง-->
<div class="grid_4 alpha" style="margin-top:10px;">
<?php
//check staff in group.
$this->db->where('member_id',$this->session->userdata('member_id'));
$check_staff = $this->db->get('staff_of_organization');
$nn_staff = $check_staff->num_rows();
?>

<?php if(($this->session->userdata('is_logged_in') == true && $nn_staff>0) || $this->session->userdata('access_level')==1)
{
?>
	<div id="side-panel-top">
	<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#009933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Organization Tool's</div>
	</div>
	<div id="side-panel-middle" style="padding-left: 22px;">
	<ul style="list-style:none;">
	<li><img src="<?=base_url()?>images/graphic/desktop.png"/> <a href="<?=base_url()?>organization/add_news">Add news</a></li>
	<li><img src="<?=base_url()?>images/graphic/find.png"/> <a href="<?=base_url()?>organization/search_news">Search news</a></li>
	<li></li>
	<img src="<?=base_url()?>images/graphic/lock.png"/> <a href="<?=base_url()?>logout">Logout</a>
	</ul>
	</div>
	<div id="side-panel-bottom"></div>
<?php } ?>
<div class="grid_4 alpha" style="margin-top:5px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Lastest News <img src="<?=base_url()?>images/graphic/rss.png"/></div>
</div>
<div id="side-panel-middle" style="padding-left: 22px;">
<ul style="list-style:none;">
<?php 
$this->db->limit(5);
$this->db->order_by("c_org_id","desc");
$query = $this->db->get('content_of_organization');
foreach($query->result() as $rows)
{
	?>
	<li><img src="<?=base_url()?>images/arrow_bullet.gif"/>&nbsp;<a href="<?=base_url()?>organization/view_details/<?=$rows->c_org_id?>"><?=$rows->c_org_title?>
	</a></li>
	<?php    
}
?>
</ul>
</div>
<div id="side-panel-bottom"></div>
</div>
<!--Left Search-->
<!--
<div class="grid_4 alpha" style="margin-top:8px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Search</div>
</div>
<div id="side-panel-middle" style="padding-left: 22px;"> dsf</div>
<div id="side-panel-bottom"></div>
</div> -->
<!--close left search-->
<!--เมนูข้าง-->
<div class="grid_4 alpha" style="margin-top:8px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Organization Category</div>
</div>
<div id="side-panel-middle" style="padding-left: 15px;">
<ul id="browser" class="filetree">
<?php
$query = $this->db->get('organization');
foreach($query->result() as $rows)
{
	$org_id = $rows->org_id;
	$org_name = $rows->org_name;
	?>
	<li class="closed"><img src="<?=base_url()?>images/building.png" /> <span><?php echo $org_name; ?></span>
	<ul>
	<li>&nbsp;<img src="<?=base_url()?>images/graphic/link.png" /><span> <a href="<?=base_url()?>organization/category/<?=$org_name?>/<?=$org_id?>">Link</a></span></li>
	<li>&nbsp;<img src="<?=base_url()?>images/graphic/feed.png" /><span> Rss/Feed</span></li>
	<li>&nbsp;<img src="<?=base_url()?>images/graphic/folder.png" /><span> Files</span></li>
	<li>&nbsp;<img src="<?=base_url()?>images/graphic/tags-label.png" /><span> Tag</span></li>
	<li>&nbsp;<img src="<?=base_url()?>images/graphic/user_business.png" /><span> Contact Staff</span></li>
	<li>&nbsp;<img src="<?=base_url()?>images/graphic/world.png" /><span> Website</span></li>
	</ul>
	</li>
	<?php
}
?>
</ul>
</div>
<div id="side-panel-bottom"></div>
</div>
<!--ปิดเมนูข้าง-->
<!--เมนูข้าง-->
<div class="grid_4 alpha" style="margin-top:8px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Statistics</div>
</div>
<div id="side-panel-middle" style="padding-left: 22px;">
<ul style="list-style:none;">
<li><img src="<?=base_url()?>images/graphic/node-insert-next.png"/>&nbsp;Organization: <?php echo $this->db->count_all_results('organization'); ?></li>
<li><img src="<?=base_url()?>images/graphic/newspaper.png"/>&nbsp;News: <?php echo $this->db->count_all_results('content_of_organization'); ?></li>
</ul>
</div>
<div id="side-panel-bottom"></div>
</div>
<!--ปิดเมนูข้าง-->
</div>
<!--ปิดเมนูข้าง-->
<div class="grid_8 omega" style="margin-top:10px;">
<div id="km-topic">
<div style="padding-left: 15px; padding-top: 11px; color: rgb(0, 0, 0); font-weight: bold; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Organization</div>
</div>
<div id="km-new-middle" style="height:auto;">
<?php
$this->db->order_by("c_org_id", "desc"); 
$this->db->where('org_id',$id);
$this->db->join('membership','membership.member_id=content_of_organization.member_id');
//$this->db->join('organization','organization.org_id=content_of_organization.org_id','left');
$query = $this->db->get('content_of_organization');
foreach($query->result() as $rows)
{
	$c_org_id = $rows->c_org_id;
	$c_org_title = $rows->c_org_title;
	$c_org_content = $rows->c_org_content;
	$c_org_date = $rows->c_org_date;
	$org_id = $rows->org_id;
	//$member_id = $rows->member_id;
	$firstname = $rows->firstname;
	$lastname = $rows->lastname;
	?>
	<!--<div class="grid_1" style="background-color:#003366;"><?php //echo $org_id; ?></div>-->
	<div class = "grid_7">
	<div style="font-weight:bold; font-size:16px;">&raquo;&nbsp;<a href="<?=base_url()?>organization/view_details/<?=$c_org_id?>"><?php echo $c_org_title; ?></a>&nbsp;
	<?php if(($this->session->userdata('is_logged_in') == true && $nn_staff>0) || $this->session->userdata('access_level')==1)
	{
	?>
		<span id="admin-tools"><a href="<?=base_url()?>organization/edit/org_news/<?=$c_org_id?>"><img src="<?=base_url()?>images/graphic/pencil.png"/></a><a href="<?=base_url()?>organization/delete/org_news/<?=$c_org_id?>"><img src="<?=base_url()?>images/graphic/eraser.png"/></a></span>
		<?php
	}
	?>
	</div>
	<div class="clear"></div>
	<div style="font-size:smaller; color:#666666; padding-top:5px; padding-bottom:3px;">วันที่ <?php echo $c_org_date; ?> โดย <?php echo $firstname."&nbsp;".$lastname; ?></div>
	<div>
	<?php $content_html = htmlspecialchars_decode($c_org_content); echo word_limiter($content_html,20); ?>
	</div>
	</div>
	<div class="clear"></div>
	<br/>
	<?php
}
?>
</div>
<div id="km-new-bottom"></div>
</div>
</div>
<div class="clear"></div>
<!--end content1-->
<div class="grid_12" style="background-color:#CCCCCC;">&nbsp;</div>
<div class="clear"></div>
<?php $this->load->view('inc/footer'); ?>
